/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package iohelpers;

import Entities.Activereservation;
import Entities.Resource;
import constants.Consts;
import helpers.Debug;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import rhserver.MainController;

/**
 *
 * @author Bari
 */
public class IOHandler {

    private BlockingQueue<Runnable> blockingQueue;
    private ThreadPoolExecutor executor;

    public IOHandler() {
        blockingQueue = new LinkedBlockingQueue<Runnable>();
        executor = new ThreadPoolExecutor(
                1,
                1,
                10,
                TimeUnit.SECONDS,
                blockingQueue);
    }

    public void ActivateResource(Resource resource) {
        executor.execute(new SendSMSAction(resource.getTelnumber(), Consts.RES_ON));
    }

    public void DeactivateResource(Resource resource) {
        executor.execute(new SendSMSAction(resource.getTelnumber(), Consts.RES_OFF));
    }
}
